package com.ofek.eventos.db.datatypes.predefined;

import com.ofek.eventos.db.datatypes.SearchDefiner;
import com.ofek.eventos.db.datatypes.Type;
import com.ofek.eventos.util.TimeUtils;

public class SearchScheme implements SearchDefiner {


	/**
	 * 
	 */
	private static final long serialVersionUID = -4252467691305520629L;
	public String startWith = null;
	public Type type = null;

	public boolean careForTime = false;
	public long from = TimeUtils.inXDays(-1);
	public long to = TimeUtils.inXDays(1);
	public String owner;
	@Override
	public String getStartsWith() {
		return startWith;
	}
	@Override
	public long getStart() {
		if (!careForTime) throw new RuntimeException("why would you ask for start time if you dont care for time?!");
		return from;
	}
	@Override
	public long getEnd() {
		if (!careForTime) throw new RuntimeException("why would you ask for start time if you dont care for time?!");
		return to;
	}
	@Override
	public Long getTypeId() {
		return type.tid;
	}
	@Override
	public boolean careForTime() {
		return careForTime;
	}
	@Override
	public String getOwner() {
		return owner;
	}
}